package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.constant.PaasConstant;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.base.PaymentBaseEnum;
import com.xbongbong.saas.enums.dictionary.PaymentStatusEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 应收款枚举
 *
 * @author feng.zheng
 * @version v1.0
 * @date 2019/1/14 15:37
 * @since v1.0
 */
@Getter
public enum PaymentEnum {
    // 应收款模板设置界面展示字段
    // other_1：基本信息
    BASE_INFO(PaymentBaseEnum.BASE_INFO.getAttr(), "enum.payment.attrName.base_info", "baseInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 10000, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // serialNo：编号
    PAYMENT_NO(PaymentBaseEnum.PAYMENT_NO.getAttr(), "enum.payment.attrName.payment_no", "paymentNo", FieldTypeEnum.SERIALNO.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9990, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_1：应收金额
    AMOUNT(PaymentBaseEnum.AMOUNT.getAttr(), "enum.payment.attrName.amount", "amount", FieldTypeEnum.NUM.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9980, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_2：实收金额
    REAL_AMOUNT(PaymentBaseEnum.REAL_AMOUNT.getAttr(), "enum.payment.attrName.real_amount", "realAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9970, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_3：未收金额
    UN_AMOUNT(PaymentBaseEnum.UN_AMOUNT.getAttr(), "enum.payment.attrName.un_amount", "unAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9960, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_61：红冲应收金额
    RED_AMOUNT(PaymentBaseEnum.RED_AMOUNT.getAttr(), "enum.payment.attrName.red_amount", "redAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9950, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // date_20：应收生成日期
    GENERATION_DATE(PaymentBaseEnum.GENERATION_DATE.getAttr(),"enum.payment.attrName.generation_time","generationDate",FieldTypeEnum.DATETIME.getType(),1,0,0,ShowTypeEnum.ALL.getCode(),9940,1,1,ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_81：应收账期
    RECEIVABLE_PERIOD(PaymentBaseEnum.RECEIVABLE_PERIOD.getAttr(),"enum.payment.attrName.receivable_period","receivablePeriod",FieldTypeEnum.ACCOUNT_PERIOD.getType(),1,0,0,ShowTypeEnum.LIST_DETAIL.getCode(),9930,1,1,ScreenTypeEnum.SCREEN_GROUP.getType()),
    // date_1：预计回款日期
    ESTIMATE_TIME(PaymentBaseEnum.ESTIMATE_TIME.getAttr(), "enum.payment.attrName.estimate_time", "estimateTime", FieldTypeEnum.DATETIME.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9920, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_82：来源单据的id，比如回款计划或者销项发票的id
    SOURCE(PaymentBaseEnum.SOURCE.getAttr(),"enum.payment.attrName.source","source",FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(),1,0,0,ShowTypeEnum.ALL.getCode(),9910,1,0,ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_4：关联客户
    CUSTOMER(PaymentBaseEnum.CUSTOMER.getAttr(), "enum.payment.attrName.customer", "customer", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9900, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_5：关联合同
    CONTRACT(PaymentBaseEnum.CONTRACT.getAttr(), "enum.payment.attrName.contract", "contract", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9890, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_8：坏账金额
    BAD_AMOUNT(PaymentBaseEnum.BAD_AMOUNT.getAttr(), "enum.payment.attrName.bad_amount", "badAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9880, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // num_4：开票金额
    INVOICE_AMOUNT(PaymentBaseEnum.INVOICE_AMOUNT.getAttr(), "enum.payment.attrName.invoice_amount", "invoiceAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9870, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_3：回款状态
    STATUS(PaymentBaseEnum.STATUS.getAttr(), "enum.payment.attrName.status", "status", FieldTypeEnum.COMBO.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9860, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 资金管理改造第一版本
     * 删除"归属人、支付方式"两个字段，暂时不删除，预先保留字段，方便回滚数据，运行一段时间后在进行删除操作
     * @author chenshan
     * @since 2019-10-30 15:42:55
     */
    // text_12：归属人
    BELONGER(PaymentBaseEnum.BELONGER.getAttr(), "enum.payment.attrName.belonger", "belonger", FieldTypeEnum.USER.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9850, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_13：支付方式
    PAYMENT_METHOD(PaymentBaseEnum.PAYMENT_METHOD.getAttr(), "enum.payment.attrName.payment_method", "paymentMethod", FieldTypeEnum.COMBO.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9840, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_6：回款类型
    PAYMENT_TYPE(PaymentBaseEnum.PAYMENT_TYPE.getAttr(), "enum.payment.attrName.payment_type", "paymentType", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9830, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // text_7：备注
    MEMO(PaymentBaseEnum.MEMO.getAttr(), "enum.payment.attrName.memo", "memo", FieldTypeEnum.TEXTAREA.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9820, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // other_2：系统信息
    SYSTEM_INFO(PaymentBaseEnum.SYSTEM_INFO.getAttr(), "enum.payment.attrName.system_info", "systemInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9810, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // creatorId：创建人
    CREATOR_ID(PaymentBaseEnum.CREATOR_ID.getAttr(), "enum.payment.attrName.creator_id", "creatorId", FieldTypeEnum.CREATORID.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9800, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // addTime：创建时间
    ADD_TIME(PaymentBaseEnum.ADD_TIME.getAttr(),"enum.payment.attrName.add_time","addTime",FieldTypeEnum.ADDTIME.getType(),1,1,0,ShowTypeEnum.ALL.getCode(),9790,1,0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // updateTime：更新时间
    UPDATE_TIME(PaymentBaseEnum.UPDATE_TIME.getAttr(),"enum.payment.attrName.update_time","updateTime",FieldTypeEnum.UPDATETIME.getType(),1,1,0,ShowTypeEnum.ALL.getCode(),9780,1,0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // array_31：逻辑字段，添加应收款
    ADD_PAYMENT(PaymentBaseEnum.ADD_PAYMENT.getAttr(), "enum.payment.attrName.add_payment", "addPayment", FieldTypeEnum.LINK_FORM.getType(), 1, 1, 0, ShowTypeEnum.EDIT.getCode(), 9770, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    // ownerId：负责人
    OWNER_ID(PaymentBaseEnum.OWNER_ID.getAttr(), "enum.payment.attrName.owner_id", "ownerId", FieldTypeEnum.OWNERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9760, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    // coUserId：协同人
    COUSERID(PaymentBaseEnum.COUSERID.getAttr(), "enum.payment.attrName.couser_id", "coUserId", FieldTypeEnum.COUSERID.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9750, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // date_2：实际回款日期
    REAL_PAY_TIME(PaymentBaseEnum.REAL_PAY_TIME.getAttr(), "enum.payment.attrName.real_pay_time", "realPayTime", FieldTypeEnum.DATETIME.getType(), 1, 1, 1, ShowTypeEnum.LIST_DETAIL.getCode(), 9740, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 原回款计划根据回款单会有红冲回款计划,资金三期 原回款计划变为 应收款,又加入红冲应收款,与原来的红冲回款计划无关
     * @author yuqian
     */
    // num_5：
    IS_RED(PaymentBaseEnum.IS_RED.getAttr(), "enum.payment.attrName.is_red", "isRed", FieldTypeEnum.COMBO_NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9730, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // num_6：
    HAS_RED(PaymentBaseEnum.HAS_RED.getAttr(), "enum.payment.attrName.has_red", "hasRed", FieldTypeEnum.COMBO_NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9720, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 一期前存在红冲，和三期的红冲 应收款概念不一样，加上一个标记隔离开
     */
    // num_62：是否是红冲应收款
    RECEIVABLE_IS_RED(PaymentBaseEnum.RECEIVABLE_IS_RED.getAttr(), "enum.payment.attrName.receivable_is_red", "receivableIsRed", FieldTypeEnum.COMBO_NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9710, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // num_63：是否有红冲应收款
    RECEIVABLE_HAS_RED(PaymentBaseEnum.RECEIVABLE_HAS_RED.getAttr(), "enum.payment.attrName.receivable_has_red", "receivableHasRed", FieldTypeEnum.COMBO_NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9700, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //没有用了可以删掉
    // num_7：
    REF_TYPE(PaymentBaseEnum.REF_TYPE.getAttr(), "enum.payment.attrName.ref_type", "refType", FieldTypeEnum.NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9690, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // num_64：关联单据业务类型
    SOURCE_REF_TYPE(PaymentBaseEnum.SOURCE_REF_TYPE.getAttr(), "enum.payment.attrName.source_ref_type", "sourceRefType", FieldTypeEnum.NUM.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9620, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_8：关联原回款
    ORIGIN_ID(PaymentBaseEnum.ORIGIN_ID.getAttr(), "enum.payment.attrName.origin_id", "originId", FieldTypeEnum.TEXT.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9770, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_84：关联原始应收
    RECEIVABLES_ORIGIN_ID(PaymentBaseEnum.RECEIVABLES_ORIGIN_ID.getAttr(), "enum.payment.attrName.receivables_origin_id", "receivablesOriginId", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9680, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_10：关联客户隐藏
    CUSTOMER_LINK_TEXT(PaymentBaseEnum.CUSTOMER_LINK_TEXT.getAttr(), "enum.payment.attrName.customer_link_text", "customerLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9670, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_11：关联合同隐藏
    CONTRACT_LINK_TEXT(PaymentBaseEnum.CONTRACT_LINK_TEXT.getAttr(), "enum.payment.attrName.contract_link_text", "contractLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9660, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_2：币种
    UNIT(PaymentBaseEnum.UNIT.getAttr(), "enum.payment.attrName.unit", "unit", FieldTypeEnum.TEXT.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9650, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_63：关联原始应收隐藏
    RECEIVABLES_ORIGIN_LINK_TEXT(PaymentBaseEnum.RECEIVABLES_ORIGIN_LINK_TEXT.getAttr(),"enum.payment.attrName.receivables_origin_link_text","receivablesOriginLinkText",FieldTypeEnum.TEXT.getType(),1,0,1,ShowTypeEnum.NONE.getCode(),9640,1,1,ScreenTypeEnum.SCREEN_OFF.getType()),
    // text_83：关联单据编号
    SOURCE_LINK_TEXT(PaymentBaseEnum.SOURCE_LINK_TEXT.getAttr(), "enum.payment.attrName.source_link_text","sourceLinkTest",FieldTypeEnum.TEXT.getType(),1,0,1,ShowTypeEnum.NONE.getCode(),9630,1,1,ScreenTypeEnum.SCREEN_OFF.getType()),

    ;

    /**
     * 英文名称
     */
    private String attr;
    /**
     * 中文名称
     */
    private String attrName;
    /**
     * 对应saas中的attr
     */
    private String saasAttr;
    /**
     * 字段类型，详见
     *
     * @see com.xbongbong.paas.enums.FieldTypeEnum
     */
    private Integer fieldType;
    /**
     * 重命名、判重、启用必填等权限
     * 1.重命名+字段权限
     * 2.重命名+字段权限+查重
     * 3.重命名+字段权限+启用、必填
     * 4.重命名+字段权限+查重+启用、必填
     * 注：pro中启用和必填是同一个权限，同时启用或同时关闭
     */
    private Integer setType;
    /**
     * 模板设计阶段字段是否允许编辑
     * 1：允许编辑
     * 0：不允许编辑
     */
    private Integer designEditable;
    /**
     * 字段是否显示在模板设计界面
     * 1：不显示
     * 0：显示
     */
    private Integer editHide;
    /**
     * 字段在各个界面（新建、编辑、列表、详情）的展现形式
     * 详见
     *
     * @see com.xbongbong.saas.enums.ShowTypeEnum
     */
    private Integer showType;
    /**
     * 字段在模板设计界面的排序
     * 建议不要用连续的数字，可以用等差数列，以防以后在两个字段之间加入新字段
     */
    private Integer sort;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private Integer required;

    /**
     * 筛选类型
     * 1：可筛选
     * 2：不可筛选
     */
    private Integer screenType;

    PaymentEnum(String attr, String attrName, String saasAttr, Integer fieldType, Integer setType, Integer designEditable,
                Integer editHide, Integer showType, Integer sort, Integer visible, Integer required, Integer screenType) {
        this.attr = attr;
        this.attrName = attrName;
        this.saasAttr = saasAttr;
        this.fieldType = fieldType;
        this.setType = setType;
        this.designEditable = designEditable;
        this.editHide = editHide;
        this.showType = showType;
        this.sort = sort;
        this.visible = visible;
        this.required = required;
        this.screenType = screenType;
    }

    /**
     * 对data内的字段拼上“data.”
     * @param cache
     * @return java.lang.String
     * @author zcp
     * @date 2019/3/1 18:12
     * @since v1.0
     * @version v1.0
     */
    public static String getAttrConnectData(PaymentEnum cache) {
        return "data." + cache.getAttr();
    }
    /**
     * 获取es查询、聚合字段
     * data在库内是json对象，对data字段内某个key做es【精确查询】时，需要在其前拼上“data.”，且【text等类型的】要在后面拼“.keyword”
     * @param cache 当前枚举对象
     * @return java.lang.String 处理后的聚合字段
     * @author zcp
     * @date 2019/2/21 14:59
     * @since v1.0
     * @version v1.0
     */
    public static String getEsAttr4Keyword(PaymentEnum cache) {
        FieldTypeEnum fieldTypeEnum = FieldTypeEnum.getFieldTypeEnum(cache.fieldType);
        //字段类型为text，或者字段在es内的类型时text，则需要在后面拼上“.keyword”
        boolean flag = fieldTypeEnum == FieldTypeEnum.TEXT || "text".equals(fieldTypeEnum.getEsalias());
        if (flag) {
            return "data." + cache.getAttr() + ".keyword";
        }
        return "data." + cache.getAttr();
    }

    /**
     * app端详情默认标题显示字段
     *
     * @author GuoJun.HU
     * @since V1.0
     * @return List
     * @date 2019/4/8 19:21
     */
    public static List<Object> getTitleAttrList() {
        return Collections.singletonList(PAYMENT_NO);
    }

    /**
     * 详情默认摘要
     *
     * @author long.rao
     * @date 2019-06-27 15:47
     */
    public static List<Object> getSummaryAttrList() {
        return Arrays.asList(CONTRACT, CUSTOMER, OWNER_ID, ESTIMATE_TIME);
    }

    private static List<String> disableEditAttr = Arrays.asList(CUSTOMER.getAttr(),CONTRACT.getAttr(),PAYMENT_NO.getAttr(),REAL_AMOUNT.getAttr(),UN_AMOUNT.getAttr(),UNIT.attr,STATUS.getAttr(),REAL_PAY_TIME.getAttr(),BELONGER.getAttr(),
            PAYMENT_METHOD.getAttr(), SOURCE.getAttr(), RECEIVABLES_ORIGIN_ID.getAttr(), RECEIVABLE_PERIOD.getAttr());

    private static List<String> unReceiveDisableEditAttr = new ArrayList<>();

    public static boolean disableEdit(String attr) {
        return disableEditAttr.contains(attr);
    }

    /**
     * 把传入的字段（类型为LINK_BUSINESS_SINGLE）的转为其隐藏字段
     * @param attr 字段名
     * @return java.lang.String
     * @author zcp
     * @date 2019/7/4 15:31
     * @since v1.0
     * @version v1.0
     */
    public static String changeToHide4Link(String attr) {
        if (Objects.equals(attr, CUSTOMER.attr)) {
            return CUSTOMER_LINK_TEXT.attr;
        } else if (Objects.equals(attr, CONTRACT.attr)) {
            return CONTRACT_LINK_TEXT.attr;
        }
        return attr;
    }

    public static Boolean getUnableEditAttrMap(boolean addUnableEdit, PaymentStatusEnum paymentStatusEnum, String attr) {
        Boolean isEdit = true;
        if ( addUnableEdit ){
            return isEdit;
        }
        Map<String, PaymentEnum> unableEditAttrMap = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        switch (paymentStatusEnum) {
            case RECEIVABLES:
            case PARTIAL_RECEIPTS:
                unableEditAttrMap.put(HAS_RED.attr, HAS_RED);
                unableEditAttrMap.put(PAYMENT_NO.attr, PAYMENT_NO);
                unableEditAttrMap.put(CUSTOMER.attr, CUSTOMER);
                unableEditAttrMap.put(CONTRACT.attr, CONTRACT);
                unableEditAttrMap.put(AMOUNT.attr, AMOUNT);
                unableEditAttrMap.put(STATUS.attr, STATUS);
                break;
            case BAD_DEBT:
            case PARTIAL_BAD_DEBT:
                unableEditAttrMap.put(HAS_RED.attr, HAS_RED);
                unableEditAttrMap.put(PAYMENT_NO.attr, PAYMENT_NO);
                unableEditAttrMap.put(CUSTOMER.attr, CUSTOMER);
                unableEditAttrMap.put(CONTRACT.attr, CONTRACT);
                unableEditAttrMap.put(AMOUNT.attr, AMOUNT);
                unableEditAttrMap.put(STATUS.attr, STATUS);
                unableEditAttrMap.put(ESTIMATE_TIME.attr, ESTIMATE_TIME);
                break;
            default:
                unableEditAttrMap.put(HAS_RED.attr, HAS_RED);
                break;
        }
        if ( unableEditAttrMap.containsKey(attr) ){
            isEdit = false;
        }
        return isEdit;
    }
    
    public static List<String> getUnableEditAttrList(boolean addUnableEdit, PaymentStatusEnum paymentStatusEnum) {
        if ( !addUnableEdit ){
            return new ArrayList<>();
        }
        switch (paymentStatusEnum) {
            case RECEIVABLES:
            case PARTIAL_RECEIPTS:
                return Arrays.asList(HAS_RED.attr, PAYMENT_NO.attr, CUSTOMER.attr, CONTRACT.attr, CONTRACT.attr, AMOUNT.attr, STATUS.attr);
            case BAD_DEBT:
            case PARTIAL_BAD_DEBT:
                return Arrays.asList(HAS_RED.attr, PAYMENT_NO.attr, CUSTOMER.attr, CONTRACT.attr, CONTRACT.attr, AMOUNT.attr, STATUS.attr, ESTIMATE_TIME.attr);
            default:
                return Arrays.asList(HAS_RED.attr);
        }
    }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }

    public static String getI18nValue(String value) {
        return I18nMessageUtil.getMessage(value);
    }

    public static List<String> getAttrs() {
        List<String> attrs = new ArrayList<>();
        for (PaymentEnum paymentEnum : values()) {
            attrs.add(paymentEnum.getAttr());
        }
        return attrs;
    }
}
